<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <table>
<!--        <thead></thead>-->
<!--        <tbody></tbody>-->
    </table>

    <script>
        let table = document.querySelector("table");
        let thead = document.createElement("thead");
        //append：支持Node节点和String，字符串不会做解析处理
        table.append(thead);
        let tr = document.createElement("tr");
        thead.appendChild(tr);

        let th = document.createElement("th");
        th.innerHTML = "<input type='checkbox'>";
        tr.appendChild(th);

        th = document.createElement("th");
        // th.innerText = "序号";
        th.textContent = "序号";
        tr.appendChild(th);

        let tbody = document.createElement("tbody");
        table.appendChild(tbody);

        tr = document.createElement("tr");
        tbody.appendChild(tr);

        //复选框
        let td = document.createElement("td");
        tr.appendChild(td);
        let input = document.createElement("input");
        input.type = "checkbox";
        td.appendChild(input);

        //序号
        td = document.createElement("td");
        tr.appendChild(td);

        td.innerText = "1";
    </script>
</body>
</html>